home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / emacs / lisp / scribe.elc < prev    next >
Text File  |  1991-01-09  |  8KB  |  120 lines

  1.  
  2. (defvar scribe-mode-syntax-table nil "\
  3. Syntax table used while in scribe mode.")
  4.  
  5. (defvar scribe-mode-abbrev-table nil "\
  6. Abbrev table used while in scribe mode.")
  7.  
  8. (defvar scribe-fancy-paragraphs nil "\
  9. *Non-NIL makes Scribe mode use a different style of paragraph separation.")
  10.  
  11. (defvar scribe-electric-quote nil "\
  12. *Non-NIL makes insert of double quote use `` or '' depending on context.")
  13.  
  14. (defvar scribe-electric-parenthesis nil "\
  15. *Non-NIL makes parenthesis char ( (]}> ) automatically insert its close
  16. if typed after an @Command form.")
  17.  
  18. (defconst scribe-open-parentheses "[({<" "\
  19. Open parenthesis characters for Scribe.")
  20.  
  21. (defconst scribe-close-parentheses "])}>" "\
  22. Close parenthesis characters for Scribe.  These should match up with
  23. scribe-open-parenthesis.")
  24.  
  25. (if (null scribe-mode-syntax-table) (let ((st (syntax-table))) (unwind-protect (progn (setq scribe-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) (set-syntax-table scribe-mode-syntax-table) (modify-syntax-entry 34 "    ") (modify-syntax-entry 92 "    ") (modify-syntax-entry 64 "w   ") (modify-syntax-entry 60 "(>  ") (modify-syntax-entry 62 ")<  ") (modify-syntax-entry 91 "(]  ") (modify-syntax-entry 93 ")[  ") (modify-syntax-entry 123 "(}  ") (modify-syntax-entry 125 "){  ") (modify-syntax-entry 39 "w   ")) (set-syntax-table st))))
  26.  
  27. (defvar scribe-mode-map nil)
  28.  
  29. (if scribe-mode-map nil (setq scribe-mode-map (make-sparse-keymap)) (define-key scribe-mode-map "    " (quote scribe-tab)) (define-key scribe-mode-map "    " (quote tab-to-tab-stop)) (define-key scribe-mode-map "s" (quote center-line)) (define-key scribe-mode-map "}" (quote up-list)) (define-key scribe-mode-map "S" (quote center-paragraph)) (define-key scribe-mode-map "\"" (quote scribe-insert-quote)) (define-key scribe-mode-map "(" (quote scribe-parenthesis)) (define-key scribe-mode-map "[" (quote scribe-parenthesis)) (define-key scribe-mode-map "{" (quote scribe-parenthesis)) (define-key scribe-mode-map "<" (quote scribe-parenthesis)) (define-key scribe-mode-map "c" (quote scribe-chapter)) (define-key scribe-mode-map "S" (quote scribe-section)) (define-key scribe-mode-map "s" (quote scribe-subsection)) (define-key scribe-mode-map "e" (quote scribe-insert-environment)) (define-key scribe-mode-map "" (quote scribe-bracket-region-be)) (define-key scribe-mode-map "[" (quote scribe-begin)) (define-key scribe-mode-map "]" (quote scribe-end)) (define-key scribe-mode-map "i" (quote scribe-italicize-word)) (define-key scribe-mode-map "b" (quote scribe-bold-word)) (define-key scribe-mode-map "u" (quote scribe-underline-word)))
  30.  
  31. (defun scribe-mode nil "\
  32. Major mode for editing files of Scribe (a text formatter) source.
  33. Scribe-mode is similar text-mode, with a few extra commands added.
  34. \\{scribe-mode-map}
  35.  
  36. Interesting variables:
  37.  
  38. scribe-fancy-paragraphs
  39.   Non-nil makes Scribe mode use a different style of paragraph separation.
  40.  
  41. scribe-electric-quote
  42.   Non-nil makes insert of double quote use `` or '' depending on context.
  43.  
  44. scribe-electric-parenthesis
  45.   Non-nil makes an open-parenthesis char (one of `([<{')
  46.   automatically insert its close if typed after an @Command form." (interactive) (byte-code "ˆÈ± È¼!ȽÉȾÉÈை\"ÈÉÈá˘!ÈâÉÈá˙!ÈâãQÉÈá²!ÈäÉ    Èá˚!ÈãÉ
  47. Èá¸!Èåçè é%É Èá˝!ÈÂa ÁbêÉÈáˇ!Èëì PÉÈÆ!Èíªî\"Ç" [scribe-mode-map mode-name major-mode nil local-abbrev-table scribe-mode-abbrev-table comment-start comment-start-skip scribe-open-parentheses comment-column comment-end paragraph-start scribe-close-parentheses paragraph-separate scribe-fancy-paragraphs compile-command scribe-mode-syntax-table kill-all-local-variables use-local-map "Scribe" scribe-mode define-abbrev-table make-local-variable "@Comment[" "]" 0 concat "\\(^[
  48. ]\\)\\|\\(^@\\w+[" "].*[" "]$\\)" "^$" "scribe " buffer-file-name set-syntax-table run-hooks text-mode-hook scribe-mode-hook] 16))
  49.  
  50. (defun scribe-tab nil (interactive) (byte-code "¹ÈˋcÇ" [nil "@\\"] 1))
  51.  
  52. (defun scribe nil "\
  53. Run Scribe on the current buffer." (interactive) (byte-code "¹Èˋ´!Ç" [nil call-interactively compile] 2))
  54.  
  55. (defun scribe-envelop-word (string count) "\
  56. Surround current word with Scribe construct @STRING[...].  COUNT
  57. specifies how many words to surround.  A negative count means to skip 
  58. backward." (byte-code "``²˚¸ !?ÄD³h!˝UIJˇ ^!È`ÉÈ—±¼Q!Â0½¾!Á:    bÈàá!Ƚˇ!È˛ â]!È`ÉÈbÈ
  59. GWÄnÊãä
  60. H!    ˘#Åfãä
  61. H!    ˘#)Än
  62. TÉÄv˚ÈÁHÈ
  63. GYÂÔ    bÈåçè#ÈbÈåéè#Á·    bÈ
  64. HcÈbÈåê
  65. H#È    bȽë!Èì!,Ç" [spos epos ccoun noparens count scribe-open-parentheses t scribe-close-parentheses string 0 nil zerop char-syntax 119 forward-sexp -1 looking-at "@\\w[" "]" forward-char 2 skip-chars-backward "\\W" 1 search-forward char-to-string insert "@end(" ")" "@begin(" "@" 3 skip-chars-forward] 19))
  66.  
  67. (defun scribe-underline-word (count) "\
  68. Underline COUNT words around point by means of Scribe constructs." (interactive "p") (byte-code "ˋÈ´ˆ\"Ç" [count nil scribe-envelop-word "u"] 3))
  69.  
  70. (defun scribe-bold-word (count) "\
  71. Boldface COUNT words around point by means of Scribe constructs." (interactive "p") (byte-code "ˋÈ´ˆ\"Ç" [count nil scribe-envelop-word "b"] 3))
  72.  
  73. (defun scribe-italicize-word (count) "\
  74. Italicize COUNT words around point by means of Scribe constructs." (interactive "p") (byte-code "ˋÈ´ˆ\"Ç" [count nil scribe-envelop-word "i"] 3))
  75.  
  76. (defun scribe-begin nil (interactive) (byte-code "ˋÈ´cȈ˜!ȯ˘˙\"Ȩ²˚Q!Ç" [scribe-open-parentheses nil "
  77. " forward-char -1 scribe-envelop-word "Begin" 0 re-search-forward "[" "]"] 6))
  78.  
  79. (defun scribe-end nil (interactive) (byte-code "ˋÈ´cȈ˜!ȯ˘˙\"Ȩ²˚Q!Ç" [scribe-open-parentheses nil "
  80. " forward-char -1 scribe-envelop-word "End" 0 re-search-forward "[" "]"] 6))
  81.  
  82. (defun scribe-chapter nil (interactive) (byte-code "ˋÈ´cȈ˜!ȯ˘˙\"Ȩ²˚Q!Ç" [scribe-open-parentheses nil "
  83. " forward-char -1 scribe-envelop-word "Chapter" 0 re-search-forward "[" "]"] 6))
  84.  
  85. (defun scribe-section nil (interactive) (byte-code "ˋÈ´cȈ˜!ȯ˘˙\"Ȩ²˚Q!Ç" [scribe-open-parentheses nil "
  86. " forward-char -1 scribe-envelop-word "Section" 0 re-search-forward "[" "]"] 6))
  87.  
  88. (defun scribe-subsection nil (interactive) (byte-code "ˋÈ´cȈ˜!ȯ˘˙\"Ȩ²˚Q!Ç" [scribe-open-parentheses nil "
  89. " forward-char -1 scribe-envelop-word "SubSection" 0 re-search-forward "[" "]"] 6))
  90.  
  91. (defun scribe-bracket-region-be (env min max) (interactive "sEnvironment: 
  92. r") (byte-code "ˆÈÊbȘ¯    ˘#È
  93. bȘ˙    ˘#)Ç" [max env min nil insert "@end(" ")
  94. " "@begin("] 5))
  95.  
  96. (defun scribe-insert-environment (env) (interactive "sEnvironment: ") (byte-code "ˋÈ´``#Ȉ˜!ȯcÈ˘˙!Ç" [env nil scribe-bracket-region-be forward-line 1 10 forward-char -1] 4))
  97.  
  98. (defun scribe-insert-quote (count) "\
  99. If scribe-electric-quote is non-NIL, insert ``, '' or \" according
  100. to preceding character.  With numeric arg N, always insert N \" characters.
  101. Else just insert \"." (interactive "P") (byte-code "˘ÈÅ    ?Â˙¨!!Áú˘˘˘h²UÂ#˚ÁæoÂ+¸Áæʳ¸`˝Z¯#Ä7`)ʳ˛`˝Z¯#ÄE`)ʳˇ`—Z¯#ÄS`)ÉÈ ?Â|
  102. ?Âe¸Áy ?Ân˛Áy
  103. VÂx˛Áy¸Áæ ?ÄÂ
  104. ?ÂÊˇÁæ ÄÖ
  105. ?ÄÖ VµˇÁæ Ä’
  106. ?Ä’ V®¸Áæ
  107. Ä… ?Ä…
  108. VˆˇÁæ
  109. ġ ?ġ
  110. VÂá˛Áæ
  111. VÄë VÂðˇÁæ
  112. VÂö˛Áæ¸c+Ç" [count scribe-electric-quote lastfore lastback lastquote t nil self-insert-command prefix-numeric-value 92 34 "``" search-backward 1000 "''" "\"" 100] 8))
  113.  
  114. (defun scribe-parenthesis (count) "\
  115. If scribe-electric-parenthesis is non-NIL, insertion of an open-parenthesis
  116. character inserts the following close parenthesis character if the
  117. preceding text is of the form @Command." (interactive "P") (byte-code "¯È¨²!!ȯ¯¯Å ?¯ÁTÊ˚¸!È`Éȳ˝P!È˛gˇ\"Ä7—` S\"É)È    ÄJ±¼½h!!\"ÉÄTÊ
  118. Hc)+Ç" [count at-command paren-char point-save scribe-electric-parenthesis nil scribe-open-parentheses scribe-close-parentheses self-insert-command prefix-numeric-value forward-char -1 skip-chars-backward "^ 
  119.      " equal 64 /= string-match regexp-quote char-to-string] 11))
  120.